const express = require("express");

const router = express.Router();

const path = require("path");

const ejs = require("ejs"); 

const cookiesession = require("cookie-session");
router.get("/login",(req,res)=>{
      res.sendFile(path.join(__dirname,"login.html"))
});
//更改默认引擎
router.use(cookiesession({
      name:"curuser",
      keys:["nkiuo94676&%87","nbihuagcb*^%^%*"]
}));
router.post("/tologin",(req,res)=>{
    let {tel="",pass=""} = req.body;
    var tipinfo = "";
      if(tel == "" || pass == "")
      {
          tipsinfo = "用户名或者密码不得为空";
      }
      else
      {
         res.send("<script>alert('登录成功');</script>");
      }
    res.render('tips.html',{tipinfo});
})
module.exports = router;